*** Analysis of Expert Survey
*** USAID Literature Review on Misinformation in the Global South
*** Created by Jessica Gottlieb
*** Created on 5/3/23

** Set working directory to get data
capture cd "Dropbox\Research\Democratic erosion\USAID literature review\Expert survey\Replication"

** Import data from Qualtrics survey
use "Misinformation Interventions Expert Survey_May 3, 2023_12.19_anon", clear

** Descriptive statistics
count if allocate_1==. // 48 did not complete the allocation exercise
count if allocate_1!=. // 138 did not complete the allocation exercise
tab role // 105 researchers, 49 practitioners, 5 policymakers

** Create and relabel variables
label var allocate_1 Inoculation
label var allocate_2 "Credibility labels"
label var allocate_3 Debunking
label var allocate_4 "Contextual labels"
label var allocate_5 "Accuracy prompts"
label var allocate_6 "Friction/reflection"
label var allocate_7 "Social/descriptive norms"
label var allocate_8 "Media literacy"
label var allocate_9 "Technique rebuttal"
label var allocate_10 "Platform alterations"
label var allocate_11 "Politician messaging"
label var allocate_12 "Journalist training"

generate researcher=(role==1)
label define researcher 0 "Practitioner/policymaker" 1 "Researcher"
label values researcher researcher

generate region=0 if expertise_3==1 & expertise_1==. & expertise_2==.
replace region=1 if expertise_3==. & (expertise_1==1 | expertise_2==1)
replace region=2 if expertise_3==1 & (expertise_1==1 | expertise_2==1)
replace region=0 if expertise_4_TEXT=="Misinformation correction generally (theory), not content specific"
replace region=1 if expertise_4_TEXT=="New USAID employee developing expertise on misinformation in developing countries."
replace region=2 if expertise_4_TEXT=="Independent media assistance"
replace region=2 if expertise_4_TEXT=="Social identity and politics, immigrant integration"
replace region=2 if expertise_4_TEXT=="Conflict"
replace region=1 if expertise_4_TEXT=="Vaccine hesitancy in Pakistan. I've looked at what makes people hesitant and misinformation has come up as a part of it."
replace region=2 if expertise_4_TEXT=="Hostile state influence and disinformation in developed and developing countries"
replace region=0 if expertise_4_TEXT=="Disinformation in Russia and the United States, political communication theory"
replace region=2 if expertise_4_TEXT=="Monitoring, evaluation, research, and learning for democracy, human rights, and governance programming in the US and Latin America and the Caribbean."
replace region=2 if expertise_4_TEXT=="Digitalization and its societal impact around the world."
label define region 0 "Global North" 1 "Global South" 2 "Both/Unclear"
label values region region

generate category=0 if researcher==0 & region==0
replace category=1 if researcher==1 & region==0
replace category=2 if researcher==0 & region==1
replace category=3 if researcher==1 & region==1
replace category=4 if researcher==0 & region==2
replace category=5 if researcher==1 & region==2
label define category 0 "Practitioner, Global North expert" 1 "Researcher, Global North expert" 2 "Practitioner, Global South expert" 3 "Researcher, Global South expert" 4 "Practitioner, expert in both/unclear" 5 "Researcher, expert in both/unclear", modify
label values category category

*Produce Figure 13 in report
catplot category if allocate_1!=., l1title("") blabel(bar) var1opts(relabel(1 `""Practitioner," "Global North expert""' 2 `""Researcher," "Global North expert""' 3 `""Practitioner," "Global South expert""' 4 `""Researcher," "Global South expert""' 5 `""Practitioner," "expert in both/unclear""' 6 `""Researcher," "expert in both/unclear""')) ytitle(Frequency)
graph export role.pdf, replace

generate globalnorth=(region==0)
label define globalnorth 0 "Global South Expert, Other" 1 "Global North Expert", modify
label values globalnorth globalnorth

** Create plots
*ssc install statplot
*ssc install cibar
*ssc install ciplot

*Produce Figure 14 in report, Figure 1 in article
generate one="one"
statplot allocate_10 allocate_8 allocate_12 allocate_1 allocate_3 allocate_11 allocate_6 allocate_7 allocate_9 allocate_4 allocate_5 allocate_2, over(globalnorth, relabel(1 `""Global South" "expert, Other" "' 2 `""Global North" "expert" "')) over(one, relabel(1 " ")) ytitle(Mean allocation) title(Allocations by respondent region of expertise)
graph export allocationsbyregion.pdf, replace

statplot allocate_10 allocate_8 allocate_12 allocate_1 allocate_3 allocate_11 allocate_6 allocate_7 allocate_9 allocate_4 allocate_5 allocate_2, over(researcher) over(one, relabel(1 " ")) ytitle(Mean allocation) title(Allocations by respondent role)
graph export allocationsbyrole.pdf, replace

* Produce Figure 15 in report

gen effective1r=6-effective1
gen effective2r=6-effective2

ciplot effective1r effective2r, by(category) horizontal ytitle("") legend(order(2 "Inoculation and debunking" 1 "95% CIs" 3 "Accuracy prompts and friction/reflection" ) pos(6) col(2)) note("") xlabel(2 `""Somewhat less effective" "than in developed country" "' 3 `""Equally as effective" "in developed country" "' 4 `""Somewhat more effective" "than in developed country" "' 4.5 " ") xline(3) xsc(range(2(1)4)) msize(medlarge large) mcolor(gs7 gs9)
graph export effective.pdf, replace

*Create Figure 16 in report: Scatterplot comparing allocations to study density
collapse (mean) allocate_*
xpose, clear
rename v1 Allocation
gen Intervention=""
replace Intervention="Inoculation" in 1
replace Intervention="Credibility labels" in 2
replace Intervention="Debunking" in 3
replace Intervention="Contextual labels" in 4
replace Intervention="Accuracy prompts" in 5
replace Intervention="Friction/reflection" in 6
replace Intervention="Social/descriptive norms" in 7
replace Intervention="Media literacy" in 8
replace Intervention="Technique rebuttal" in 9
replace Intervention="Platform alterations" in 10
replace Intervention="Politician messaging" in 11
replace Intervention="Journalist training" in 12

gen GNstudies=0
replace GNstudies=23 in 1
replace GNstudies=46 in 3
replace GNstudies=25 in 2
replace GNstudies=5 in 4
replace GNstudies=10 in 8
replace GNstudies=15 in 5
replace GNstudies=6 in 6
replace GNstudies=8 in 7
replace GNstudies=8 in 10 
replace GNstudies=3 in 11
replace GNstudies=4 in 12

gen GSstudies=0
replace GSstudies=6 in 1
replace GSstudies=8 in 3
replace GSstudies=1 in 2
replace GSstudies=1 in 4
replace GSstudies=6 in 8
replace GSstudies=3 in 5
replace GSstudies=1 in 6
replace GSstudies=2 in 7
replace GSstudies=2 in 10 
replace GSstudies=0 in 11
replace GSstudies=0 in 12

gen Allstudies=GNstudies+GSstudies
label var Allstudies "Number of studies"

label var GNstudies "Global North studies"
label var GSstudies "Global South studies"
label var Allocation "Mean allocation by experts"

twoway scatter Allocation GNstudies, mlabel(Intervention) mlabposition(1) mlabgap(tiny) ylabel(5(5)15) name(gn, replace) scale(.9)
graph export expert_gnstudies.pdf, replace
twoway scatter Allocation GSstudies, mlabel(Intervention) mlabposition(1) mlabgap(tiny) ylabel(5(5)15)  xlabel(0(10)15) name(gs, replace) scale(.9)
graph export expert_gsstudies.pdf, replace
